///////////////////////////////////////////////////////////////////////////////
//	FILENAME:	DebugCounter.m
//	SUMMARY:	a debugging tool that displays the number of draw: messages
//	SUPERCLASS:	Object
//	INTERFACE:	None
//	PROTOCOLS:	<Annotation, Tool>
//	AUTHOR:		Rohit Khare
//	COPYRIGHT:	(c) 1994 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
//	DESCRIPTION
//		Does its job by displaying a counter var.
///////////////////////////////////////////////////////////////////////////////
//	HISTORY
//	10/31/94:	Brought into eText5.
//	05/13/94:	Created. First actual implementation.
///////////////////////////////////////////////////////////////////////////////

#import "../eTextKernel.h"
@interface DebugCounter:Object <Annotation, Tool>
{int counter,highlighted;}
@end
@implementation DebugCounter
+ toolAwake:theApp
{
	[theApp   registerAnnotation: [DebugCounter class] 
							name: "DebugCounter"
					RTFDirective: "DebugCounter"
					   menuLabel: "Debug/Insert counter..."
						 menuKey: '\0'
						menuIcon: (NXImage *) nil];
	return self;
}
- init {[super init]; counter = highlighted = 0; return self;}
- initFromPboard:thePB inDoc:theDoc linked:(BOOL) linked {return [self init];}
- calcCellSize:(NXSize *)theSize 
	{theSize->width = theSize->height = 16.0; return self;}
- drawSelf:(const NXRect *)rect inView:view
	{	char tmp[10];
		NXEraseRect(rect);
		PSsetgray(highlighted ? NX_DKGRAY : NX_BLACK);
		PSmoveto(NX_X(rect), NX_Y(rect) + NX_HEIGHT(rect));
		sprintf(tmp,"%d",counter++);
		PSshow(tmp);
		return self;
	}
- highlight:(const NXRect *)rect inView:view lit:(BOOL)flag
	{highlighted = !highlighted; NXHighlightRect(rect);return self;}
- (BOOL)	trackMouse:(NXEvent *)theEvent
			inRect:(const NXRect *)rect
			ofView:view
	{return NO;}
- readRichText:(NXStream *)stream forView:view 
	{return self;}
- writeRichText:(NXStream *)stream forView:view
	{return self;}
@end